package com.chis.json;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2020年03月12日
 */
public class Test {

    public static void main(String[] args) {
        MainBean mainBean = new MainBean();
        List<SubBean> l1 = new ArrayList<>();
        SubBean subBean = new SubBean();
        subBean.setName("1111");
        subBean.setSex("1111");
        l1.add(subBean);
        subBean = new SubBean();
        subBean.setName("2222");
        subBean.setSex("2222");
        l1.add(subBean);
        mainBean.setSuclist(l1);
        List<SubBean> l2 = new ArrayList<>();
        subBean = new SubBean();
        subBean.setName("3333");
        subBean.setSex("3333");
        l2.add(subBean);
        subBean = new SubBean();
        subBean.setName("4444");
        subBean.setSex("4444");
        l2.add(subBean);
        mainBean.setErrlist(l2);
        String str = JSON.toJSONString(mainBean);
        System.out.println(str);
    }

}
